Skip to content

fix: Fix validate command: unify CLI/TUI logic, add missing schema checks, improve TUI screen (#12)#13

Open
aidandaly24 wants to merge 1 commit intomainfrom
loopy/issue-12
Open

fix: Fix validate command: unify CLI/TUI logic, add missing schema checks, improve TUI screen (#12)#13
aidandaly24 wants to merge 1 commit intomainfrom
loopy/issue-12

Conversation

@aidandaly24
Copy link
Copy Markdown
Owner

@aidandaly24 aidandaly24 commented Mar 19, 2026

Summary

Fixes #12 — The agentcore validate command had divergent behavior between CLI and TUI modes, missing schema validations, and duplicated business logic.

Changes

src/cli/commands/validate/action.ts

  • Added mcp.json and mcp-defs.json validation — CLI now validates all 5 config files (matching TUI behavior)
  • Reports all errors instead of stopping on the first failure — the function now iterates through all files and collects per-file results
  • New ValidateFileResult type with per-file { file, success, skipped?, error? } — enables both CLI and TUI to show granular status
  • Updated ValidateResult to include a results: ValidateFileResult[] array alongside the existing success/error fields
  • Optional files (mcp.json, mcp-defs.json, .cli/state.json) are gracefully skipped when absent

src/cli/commands/validate/command.tsx

  • Displays all validation errors (joined by newline) instead of just the first one

src/cli/tui/screens/validate/ValidateScreen.tsx

  • Refactored to call handleValidate() from action.ts instead of reimplementing validation logic independently
  • Maps ValidateFileResult[] to Step[] for the StepProgress UI component
  • Added meaningful next steps: suggests "deploy" and "status" on successful validation (was previously steps={[]})

src/cli/commands/validate/index.ts

  • Exports new ValidateFileResult type

src/cli/commands/index.ts

  • Added missing registerValidate re-export (consistent with all other commands)

src/cli/commands/validate/__tests__/action.test.ts

  • Added 8 new tests covering:
    • mcp.json validation when present
    • mcp.json skipped when absent
    • mcp.json error handling
    • mcp-defs.json validation when present
    • mcp-defs.json skipped when absent
    • mcp-defs.json error handling
    • All errors reported (not just first)
    • All 5 files validated when present
  • Updated existing tests to work with new results array in return type
  • 20 tests total, all passing

Acceptance Criteria

  • agentcore validate validates all 5 config files (agentcore.json, aws-targets.json, mcp.json, mcp-defs.json, .cli/state.json)
  • CLI and TUI produce consistent validation results
  • TUI validate screen reuses handleValidate() — no duplicated validation logic
  • All validation errors are reported (not just the first)
  • TUI shows "deploy" as a suggested next step on successful validation
  • registerValidate is re-exported from src/cli/commands/index.ts
  • Unit tests cover mcp.json and mcp-defs.json validation paths
  • Existing integration tests still pass

@github-actions github-actions Bot added the size/m PR size: M label Mar 19, 2026
@aidandaly24 aidandaly24 changed the title fix: Fix validate command: unify CLI/TUI logic, add missing schema checks, improve TUI screen (#12) fix: unify CLI/TUI validate logic, add missing schema checks, improve TUI screen Mar 19, 2026
@github-actions github-actions Bot added size/m PR size: M size/l PR size: L and removed size/m PR size: M size/l PR size: L labels Mar 19, 2026
@aidandaly24
Copy link
Copy Markdown
Owner Author

CI Status Analysis

The CI failures on this PR are pre-existing on main and not introduced by these changes:

Build failures (20.x, 22.x, 24.x)

The build jobs run npm run test:unit and npm run test:integ. Running the full test suite locally on both main and this branch produces identical failure counts:

Branch Unit Test Files Failed Unit Tests Failed Unit Tests Passed Integ Files Failed
main 17 6 2177 3
loopy/issue-12 17 6 2202 (+25) 3

This branch adds 25 more passing tests (20 new validate tests + 5 existing tests now counted) with zero new failures.

Security failure

The security job fails due to a pre-existing npm audit vulnerability in fast-xml-parser (transitive dependency via @aws-sdk/xml-builder). This is present on main as well.

Passing checks (our changes)

  • typechecktsc --noEmit passes
  • lint — ESLint passes
  • format — Prettier passes
  • secrets — No secrets detected
  • All 20 validate unit tests pass

@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Mar 19, 2026
@github-actions github-actions Bot added the size/m PR size: M label Mar 19, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 19, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.12% 4912 / 11389
🔵 Statements 42.73% 5203 / 12174
🔵 Functions 42.48% 902 / 2123
🔵 Branches 44.59% 3176 / 7122
Generated in workflow #50 for commit 2b3859c by the Vitest Coverage Report Action

@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Mar 20, 2026
@aidandaly24 aidandaly24 changed the title fix: unify CLI/TUI validate logic, add missing schema checks, improve TUI screen fix: Fix validate command: unify CLI/TUI logic, add missing schema checks, improve TUI screen (#12) Mar 20, 2026
@github-actions
Copy link
Copy Markdown

Package Tarball

aws-agentcore-0.3.0-preview.6.1.tgz

How to install

npm install https://github.com/aidandaly24/agentcore-cli/releases/download/pr-13-tarball/aws-agentcore-0.3.0-preview.6.1.tgz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix validate command: unify CLI/TUI logic, add missing schema checks, improve TUI screen

1 participant